import { get,post } from '@/utils/request'

export default {
  namespaced:true,
  state:{
      informations:[]
  },
  mutations:{
    // 获取数据
    SET_DATA(state,data) {
      state.informations = data
    }
  },
  actions:{
    // 获取数据
      getInformation(content){
        get('/category/findAll').then((res)=>{
            console.log(res)
            content.commit('SET_DATA',res.data)

        })
      },
      // 新增
      addInformation(content,data) {
      let response = post('/category/saveOrUpdate',data)
          console.log(data)
          return response

      },
      // 删除
      delInformation(content,id) {
      let response = get('/category/deleteById',id)
            return response
      }
  }
}
